/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.thongtinsv.controller;

import com.thongtinsv.entity.User;
import com.thongtinsv.model.UserModel;
import java.util.List;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 *
 * @author tritruong
 */
@Controller
@RequestMapping(value = "/helloworld_controller")
public class HelloWorldController {

	@RequestMapping(value = "index")
	public ModelAndView actionIndex() {
		ModelAndView m = new ModelAndView("index");
		return m;
	}
	
	@RequestMapping(value = "helloworld")
	public ModelAndView actionSayHello() {
		return this.HelloWorldController();
	}
	
	public ModelAndView HelloWorldController() {
		ModelAndView m = new ModelAndView("helloworld");
		String strMsg = "OK";
		m.addObject("message", strMsg);
		
		List<User> lstUser = UserModel.getRandomUser(3);
		m.addObject("list_user", lstUser);
		return m;
	}
	
}
